package com.github.catvod.spider.merge;

import android.text.TextUtils;
import java.io.IOException;
import java.util.List;
import java.util.Map;
import okhttp3.FormBody;
import okhttp3.MediaType;
import okhttp3.OkHttpClient;
import okhttp3.Request;
import okhttp3.RequestBody;
import okhttp3.Response;

class k {
  private String BQ;
  
  private final String I;
  
  private final Map<String, String> V0;
  
  private Object W;
  
  private final Map<String, List<String>> h;
  
  private final Map<String, String> j;
  
  private Request oC;
  
  private final String q;
  
  private k(String paramString1, String paramString2, String paramString3, Map<String, String> paramMap1, Map<String, String> paramMap2, Map<String, List<String>> paramMap) {
    this.BQ = paramString2;
    this.I = paramString3;
    this.q = paramString1;
    this.j = paramMap1;
    this.V0 = paramMap2;
    this.h = paramMap;
    V0();
  }
  
  k(String paramString1, String paramString2, Map<String, String> paramMap1, Map<String, String> paramMap2, Map<String, List<String>> paramMap) {
    this(paramString1, paramString2, null, paramMap1, paramMap2, paramMap);
  }
  
  private void V0() {
    Request.Builder builder = new Request.Builder();
    if (this.q.equals("GET") && this.j != null)
      q(); 
    if (this.q.equals("POST"))
      builder.post(j()); 
    Map<String, String> map = this.V0;
    if (map != null)
      for (String str : map.keySet())
        builder.addHeader(str, this.V0.get(str));  
    Object object = this.W;
    if (object != null)
      builder.tag(object); 
    this.oC = builder.url(this.BQ).build();
  }
  
  private RequestBody j() {
    if (!TextUtils.isEmpty(this.I))
      return RequestBody.create(MediaType.parse("application/json; charset=utf-8"), this.I); 
    FormBody.Builder builder = new FormBody.Builder(CE.q);
    Map<String, String> map = this.j;
    if (map != null)
      for (String str : map.keySet())
        builder.add(str, this.j.get(str));  
    return (RequestBody)builder.build();
  }
  
  private void q() {
    StringBuilder stringBuilder = new StringBuilder();
    stringBuilder.append(this.BQ);
    stringBuilder.append("?");
    this.BQ = stringBuilder.toString();
    for (String str2 : this.j.keySet()) {
      String str1 = this.BQ;
      StringBuilder stringBuilder1 = new StringBuilder();
      stringBuilder1.append(str2);
      stringBuilder1.append("=");
      stringBuilder1.append(this.j.get(str2));
      stringBuilder1.append("&");
      this.BQ = str1.concat(stringBuilder1.toString());
    } 
    String str = this.BQ;
    this.BQ = str.substring(0, str.length() - 1);
  }
  
  public String h(OkHttpClient paramOkHttpClient) {
    try {
      Response response = paramOkHttpClient.newCall(this.oC).execute();
      Map<String, List<String>> map = this.h;
      if (map != null)
        map.clear(); 
      map = this.h;
      if (map != null)
        map.putAll(response.headers().toMultimap()); 
      return response.body().string();
    } catch (IOException iOException) {
      return "";
    } 
  }
}


/* Location:              /Users/hetaiyi/Desktop/my/tech/java/study/aa/temp/temp.jar!/com/github/catvod/spider/merge/k.class
 * Java compiler version: 6 (50.0)
 * JD-Core Version:       1.1.3
 */